# -*- coding: utf-8 -*-
from time import sleep
import scrapy
from doubanmv.items import DoubanmvItem

class NewSpider(scrapy.Spider):
    name = 'new'
    # allowed_domains = ['movie.douban.com']
    start_urls = ['https://movie.douban.com/top250']

    def parse(self, response):
        # sleep(1)
        item = DoubanmvItem()
        
        # item['names'] = response.xpath('//*[@class="gaia gaia-lite gaia-movie slide-mode"]'
        #                                '//*[@class="slide-page"]//p/strong/text()').extract()
        item['names'] = response.xpath('//*[ @id="content"]//a/span[1]/text()').extract()
        item['stars'] = response.xpath('//*[@class="rating_num"]/text()').extract()
        # print(item)
        yield item
